use pcap::{Device, DeviceFlags};
use serde::{Deserialize, Serialize};

#[derive(Debug,Serialize,Deserialize,Clone,PartialEq)]
pub struct ConfigDevice {
    pub device_name: String,
}

impl Default for ConfigDevice {
    fn default() -> Self {
        Self { 
            device_name: Device::lookup()
                .unwrap_or(None)
                .unwrap_or_else(|| Device {
                    name: String::new(),
                    desc: None,
                    addresses: vec![],
                    flags: DeviceFlags::empty(),
                })
                .name,
        }
    }
}

#[test]
fn test_config_device(){
    let cd = ConfigDevice::default();
    println!("{:?}",cd);
}

impl ConfigDevice {
    /* 
    pub fn load() -> Self {

    }

    pub fn store(self){

    }

    pub fn to_my_device(&self) -> MyDevice {

    }
    */
}

#[cfg(test)]
mod tests {

}